<div class="bjui-pageHeader">
    <form id="pagerForm" data-toggle="ajaxsearch" action="${request.getContextPath()}/OutsourcedProcessing/outsourcedProcessing" method="post">
        <div class="bjui-searchBar">
            <g:hiddenField name="SYS_QUERY_NAME" value="outsourcedProcessing" />
            <g:hiddenField name="EXPORT_CONTENT_NAME" value="Excel" />
            <label >时间段：</label>&nbsp;
            <input type="text" name="startTime" value="${startTime}" data-pattern="yyyy-MM-dd"  data-toggle="datepicker" placeholder="FROM">&nbsp;
            <input type="text" name="endTime" value="${endTime}" data-pattern="yyyy-MM-dd" data-toggle="datepicker" placeholder="TO">&nbsp;&nbsp;
            <label >委外单号：</label>&nbsp;
            <input type="text" name="docId" value="${docId}"/>&nbsp;&nbsp;
            <label >图号：</label>&nbsp;
            <input type="text" name="partId" value="${partId}"/>&nbsp;&nbsp;
            <label >状态：</label>&nbsp;
            <input type="text" name="ZT" value="${ZT}"/>&nbsp;&nbsp;
            <label >委外原因：</label>&nbsp;
            <input type="text" name="yuanyin" value="${yuanyin}"/>&nbsp;&nbsp;

            <button type="submit" class="btn-default" data-icon="search">查询</button>&nbsp;
            <button type="button" class="btn-blue" onclick="javascript:bjuiExportExl('#pagerForm','${request.getContextPath()}/OutsourcedProcessing /exportExcel')" data-icon="file-excel-o" title="导出Excel">导出</button>&nbsp;
        </div>
    </form>
</div>

<div class="bjui-pageContent">
    <g:if test="${outsourcedProcessing.size() > 0}">
        <table id="lapEndByBatch" data-toggle="tablefixed" data-width="100%" data-nowrap="true">
            <thead>
            <tr id="t1">
                <g:each in="${tableHeadList}" status="j" var="headInstance">
                    <g:if test="${headInstance!='RN'}">
                        <th  width="125"><g:message code="${headInstance}" default="${headInstance}"/></th>
                    </g:if>
                </g:each>
            </tr>
            </thead>
            <tbody>
            <g:if test="${outsourcedProcessing.size()>0}">
                <g:each in="${outsourcedProcessing}" status="i" var="dataInstance">
                    <tr>
                        <g:each in="${tableHeadList}" status="j" var="headInstance">
                            <g:if test="${headInstance=='MAIN_QTY'}">
                                <td name="progressNormal${i+1}">
                                    ${dataInstance["${headInstance}"] }
                                </td>
                            </g:if>
                            <g:elseif test="${headInstance=='OUT_QTY'}">
                                <td name="progressRework${i+1}">
                                    ${dataInstance["${headInstance}"] }
                                </td>
                            </g:elseif>
                            <g:elseif test="${headInstance=='OUTSRC_FIN_QTY'}">
                                <td name="progressOrc${i+1}">
                                    ${dataInstance["${headInstance}"] }
                                </td>
                            </g:elseif>
                            <g:elseif test="${headInstance=='OUTSRC_RUN_QTY'}">
                                <td name="progressScrap${i+1}">
                                    ${dataInstance["${headInstance}"] }
                                </td>
                            </g:elseif>
                            <g:elseif test="${headInstance=='ZT'}">
                                <td >
                                    ${dataInstance["${headInstance}"] }
                                </td>
                            </g:elseif>
                            <g:elseif test="${headInstance!='RN'}">
                                <td>${dataInstance["${headInstance}"]}</td>
                            </g:elseif>
                        </g:each>
                    </tr>
                </g:each>
                <tr>
                    <td colspan="7">小计</td>
                    <td id="normalShow"></td>
                    <td id="reworkShow"></td>
                    <td id="orcShow"></td>
                    <td id="scrapShow"></td>
                    <td colspan="3"></td>
                </tr>
                <tr>

                    <td colspan="7">合计</td>
                    <td>${outsourcedProcessingSumQty[0].SUM_MAIN_QTY}</td>
                    <td>${outsourcedProcessingSumQty[0].SUM_OUT_QTY}</td>
                    <td>${outsourcedProcessingSumQty[0].SUM_OUTSRC_FIN_QTY}</td>
                    <td>${outsourcedProcessingSumQty[0].SUM_OUTSRC_RUN_QTY}</td>
                    <td colspan="3"></td>
                </tr>

            </g:if>
            <g:else>
                <g:render template="../template/emptyPanel" />
            </g:else>
            </tbody>
        </table>
    </g:if>
</div>
<g:render template="../template/pagination" />

<script>
    $(function(){
        /*获取当页正常数量的小计*/
        var progressN=0
        for(var i=1;i<=${outsourcedProcessing.size()};i++){
            var progressNo='progressNormal'+i
            var progressNor=parseInt($("td[name='"+progressNo+"']").text());
            if(isNaN(progressNor)){
                progressNor=0
            }
            progressN+=progressNor
        }
        progressN = isNaN(parseInt(progressN))?0:progressN
        $("#normalShow").html(progressN);

        /*获取当页返修数量的小计*/
        var progressR=0
        for(var i=1;i<=${outsourcedProcessing.size()};i++){
            var progressRe='progressRework'+i
            var progressRew=isNaN(parseInt($("td[name='"+progressRe+"']").text()))?0:parseInt($("td[name='"+progressRe+"']").text());
            progressR+=progressRew
        }
        progressR = isNaN(parseInt(progressR))?0:progressR
        $("#reworkShow").html(progressR);

        /*获取当页外协数量的小计*/
        var progressO=0
        for(var i=1;i<=${outsourcedProcessing.size()};i++){
            var progressOr='progressOrc'+i
            var progressOrc=isNaN(parseInt($("td[name='"+progressOr+"']").text()))?0:parseInt($("td[name='"+progressOr+"']").text())
            progressO+=progressOrc
        }
        progressO = isNaN(parseInt(progressO))?0:progressO
        $("#orcShow").html(progressO);

        /*获取当页报废数量的小计*/
        var progressS=0
        for(var i=1;i<=${outsourcedProcessing.size()};i++){
            var progressSc='progressScrap'+i
            var progressScr=isNaN(parseInt($("td[name='"+progressSc+"']").text()))?0:parseInt($("td[name='"+progressSc+"']").text());
            progressS+=progressScr
        }
        progressS = isNaN(parseInt(progressS))?0:progressS
        $("#scrapShow").html(progressS);
    })
</script>


